Optimizing the initialization of a queue via a batch operation

ABSTRACT

A method, a computer program product, and a system for performing a batch processing are provided. The batch processing includes initializing a set of elements corresponding to a set of resources to produce an initialized group and chaining the initialized group to previously initialized elements to produce an element batch, when the previously initialized elements are available. The batch processing further includes setting a system lock on the set of resources after the element batch is produced; executing a service routine to move the element batch to a queue by referencing first and last elements of the element batch; and releasing the system lock on the set of resources once the service routine is complete.

DOMESTIC PRIORITY

This application is a continuation of U.S. application Ser. No.14/658,729, filed on Mar. 16, 2015, the disclosure of which isincorporated by reference herein in its entirety.

BACKGROUND

The present disclosure relates generally to optimizing theinitialization of a queue via a batch operation, and more specifically,to improving, via a batch operation, the processing involved inpopulating a queue of elements while maintaining proper serialization toensure the integrity and accuracy of the queue.

In general, when a queue of elements is being initialized (e.g., queueinitialization), a service routine is called/executed by the processorfor each individual element being moved to the queue. This serviceroutine separately handles queuing of the individual element andhousekeeping associated with the queue (e.g., updating counts, creatingappropriate trace entries, etc.). Further, as each element represents aresource within a system, proper serialization via a system lock must bemaintained throughout queue initializations to prevent premature use ofresources represented by the queue elements and to ensure the integrityand accuracy of the queue. In this way, contemporary approaches to queueinitialization is a ‘one at a time’ processing.

This ‘one at a time’ processing leads to high lock contention ofresources since the system lock used for a queue also serializes othersystem resources. Further, other processes that need the system lockmust wait until the queue initialization is complete, which causesripple delays. In addition, in cases where the number of elements on thequeue grows based on the size of the system, the overhead processingtime associated with queue initialization increases significantly as thesize of the system increases. With size increases, scalability issuesarise with respect to memory capacity, a number of supported devices, anumber of supported processors, etc.

SUMMARY

Embodiments include a method, system, and computer program product forperforming a batch processing. The batch processing includesinitializing a set of elements corresponding to a set of resources toproduce an initialized group and chaining the initialized group topreviously initialized elements to produce an element batch, when thepreviously initialized elements are available. The batch processingfurther includes setting a system lock on the set of resources after theelement batch is produced; executing a service routine to move theelement batch to a queue by referencing first and last elements of theelement batch; and releasing the system lock on the set of resourcesonce the service routine is complete.

Additional features and advantages are realized through the techniquesof the present disclosure. Other embodiments and aspects of thedisclosure are described in detail herein. For a better understanding ofthe disclosure with the advantages and the features, refer to thedescription and to the drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The subject matter which is regarded as the invention is particularlypointed out and distinctly claimed in the claims at the conclusion ofthe specification. The forgoing and other features, and advantages ofthe invention are apparent from the following detailed description takenin conjunction with the accompanying drawings in which:

FIG. 1 depicts a process flow for a batch operation in accordance withan embodiment;

FIG. 2A depicts another process flow for a batch operation in accordancewith an embodiment;

FIG. 2B illustrates an operation of a global queue in accordance with anembodiment; and

FIG. 3 depicts a processing system in accordance with an embodiment.

DETAILED DESCRIPTION

Embodiments described herein relate to improving, via a batch operation,the processing involved in populating a queue of elements of a computersystem while maintaining proper serialization to ensure the integrityand accuracy of the queue. The batch processing can extend to any queueof any resources to optimally manage any request to return a batch ofresources. For example, embodiments herein provide a method executedwithin a processor of a computer system to manage a global queue of theprocessor with respect to real storage of the computer system.

The batch processing described herein is necessarily rooted in thecomputer system to perform proactive operations to overcome problemsspecifically arising in the realm of queue initialization of thatcomputer system with respect to serializing resources (e.g., theseproblems include the extended system locks, ripple delays, and/orprocessing overhead that result in unwanted computational costs andexpenses). For example, in view of contemporary approaches of movingelements one at a time and holding a system lock throughout this entiremoving process are non-optimal, the embodiments of batch operationsdescribed herein (coupled with holding the system lock only whennecessary) reduce and/or eliminate locks, delays, and overheadspecifically arising in the realm of contemporary queue initialization.

In general, a computer system is any physical or virtual electronicdevice with at least one processor and at least one memory (an exampleof a computer system is further described below with respect to FIG. 3).The processor can further include multiple engines or cores operatingconcurrently. The computer system can employ an embodiment ofserializing resources via the processor as described herein.

A resource can be any physical or virtual component of limitedavailability within the computer system. Example resources include, butare not limited to, electronic devices connected to the computer system,internal system components, virtual system resources, networkconnections, and memory areas. Managing resources can be referred to asresource management, and includes resource serialization, managingresource locks, and managing queues of elements corresponding to theresources.

Resource serialization is a coordination of access to the resources,when the resources are used by more than one application. Examples ofoperations carried out by resource serialization include grantingexclusive access to data for an application and granting shared accessto data for applications.

A system lock, in general, is a hold or a freeze on a resource thatprevents access to that resource (e.g., releasing a resource when aprocess has finished using it and dealing with resource contention whenmultiple processes wish to access a limited resource). For example, if10 different processors of the computer system are attempting to accessa specific resource, a system lock is employed on that specific resourceto serialize access (exclusive and shared access to a specificresource). The system lock may also be referred to as a resource lock, aresource queue lock, and/or processor lock.

A queue is an abstract data type in which entities or elements in thequeue are kept in order. The elements can be addresses pointing to theresources (e.g., represent real storage frames). The operations of thequeue include the addition of elements to a rear terminal position(known as enqueue) and removal of entities from the front terminalposition (known as dequeue). The operations of the queue alsosupport/allow adding to a beginning (front) of a queue and removing froman end of the queue. One example of a queue can include a doublethreaded queue of elements that includes forward and backward pointersmoving from first to last. The double threaded queue can be located onand managed by the processor of the computer system, with the elementspointing to real storage frames stored on a central storage of theprocessor. The queue can be a global queue that is centralized structurefor referencing/modifying elements. Note that the queue can beconstructed and managed via hardware and/or software.

Embodiments of batch operations will now be described with respect toFIGS. 1-2B. Turning now to FIG. 1, a process flow 100 is generally shownin accordance with an embodiment. The process flow 100 begins at block105, where a processor of a computer system receives a request forresources. A set of elements corresponds to the resources of thisrequest. These elements, at block 110, are then initialized and chainedby the processor to any previously initialized elements, which resultsin a batch or range of elements. Note that elements are initialized andchained while not holding a system lock.

The batch size may be variable, as the processor (or engine) thatmanages the batch move can manage variably sized batches (i.e.,dynamically adjust the batch sizes) from a single element to infiniteelements. In the case of initializing all real storage of the computersystem, increment sizes of the real storage can dictate the batch sizethat will be initialized. In other cases, a component or resource itselfcan apply a limiting number to the batch size. In another case, a sizeof a request for resources can dictate the batch size. In turn, thequeue size can also be variable.

Once all elements are initialized and ready to be moved to the queue,the process flow 100 proceeds to block 115, where the processor sets asystem lock on the resources associated with the batch or range ofelements. At block 120, a service routine is called by the processor tomove the batch or range of elements to the queue. Note the serviceroutine called by the processor is configured to manage both singleelement requests and the batch queue request of block 105. The serviceroutine does not examine each element in the batch or range of elements,as the service routine only references the elements needed to add thebatch to the queue. In this way, the processor utilizes the serviceroutine to reference first and last elements of the batch or range ofelements to add them to the queue (e.g., the ‘middle’ elements are notreferenced by the service routine). The service can avoid access to theresources once the lock is held. Note that other hardware and/orsoftware, such as virtual engines, physical processor cores, call theservice routine. Once the batch or range of elements is moved and oncethe resources are referenced, the system lock on the resourcesassociated with the batch or range of elements is released by theprocessor as shown in block 125.

Turning now to FIG. 2A, a process flow 200 is generally shown inaccordance with an embodiment. The process flow 200 can begin after aprocessor of a computer system receives a request for resources. Thatis, after the request is received, the process flow 200 can proceed toblock 205. At block 205, an indicator is set to signify that an elementgroup is being initialized and is not yet available with respect to theindicator of block 225 below. For example, the indicator can be aBoolean operator that indicates when a corresponding increment of realstorage is not available or is available (the indicator can be set whenthe initialization is complete, indicating that the element group is nowavailable). Other processes in the computer system, which are attemptingto access the elements being initialized, are updated to check theindicator to verify that the elements are available for use. Thisensures that the elements will not be used prematurely even though thesystem lock is not held. Further, the indicator can be one of aplurality of indicators corresponding to a plurality of increments ofthe real storage, and the plurality of indicators can be located on orreside in the virtual storage.

Next, at block 210, the processor releases any currently held systemlocks (and in turn release any corresponding indicators other than theindicator of block 205). Then, at block 215, the processor identifies anelement batch/range (with respect to the element group) requiringinitialization. At block 220, all elements identified in the elementbatch/range are then initialized by the processor. These elements arefurther chained to any previously initialized elements until allelements in the batch/range have been processed, which results in acurrent element batch.

Next, at block 225, the processor obtains a system lock (which matchesthe indicator of block 205) on the resources associated with the currentelement batch. Further, the processor calls a service routine to movethe current element batch to a global queue. The service routine cansupport an option of adding a new batch of elements to the beginning orend of the existing global queue, based on a caller of the serviceroutine passing an indicator of the desired placement of the new batchof elements.

If adding to the beginning of an existing global queue, the last elementin the new batch is queued to the first element of the existing globalqueue. The pointer to the first element in the queue header is updatedwith the address of the new first element. If adding to the end of theexisting global queue, the first element in the new batch is queued tothe last element of the existing global queue. The pointer to the lastelement in the queue header is updated with the address of the new lastelement. For example, FIG. 2B illustrates an operation 225B of a globalqueue. In FIG. 2B, a global queue header 226 has first and last elementsthat point respectively to elements 227 a and 227 n. In this way, middleelements 227 b and 227 n-1 are not referenced when adding a new batch tothe global queue. Note that all elements on the global queue are chainedvia a forward and backward pointer (not shown in FIG. 2B).

Then, at block 230, the processor updates counts representing a numberof elements on the global queue. Then, with the resources processed andthe queue updated, the system lock on the resources associated with thecurrent element batch is released by the processor as shown in block235. Further, the processor begins processing a next element batch/rangeof the global queue. Then, at block 240, the processor obtains anothersystem lock and resets the indicator to signal that the element group isnow fully initialized (once all element batches/ranges have beenprocessed for the next element batch/range).

An application of the above embodiments can relate to the initializationof real storage available frame queues of a computer system that isperformed by the Real Storage Manager (RSM). Each element on thesequeues can represent a 4K block of real storage. As the amount of realstorage supported on the computer system grows into the terabyte range,these queues grow to extremely large lengths (e.g., 1TB of real storagerequires approximately 268 million elements). In contrast toconventional approaches that result in various problems when dealingwith queues of such length (e.g., increased system initial program loadtimes, lock contention, delays in running other system initializationroutines that rely on the completion of real storage initialization),the application of the above embodiments maintains acceptable realstorage initialization times on the computer system with such large realmemory configurations.

In view of the above, a computer system will now be described withrespect to FIG. 3. Referring now to FIG. 3, there is shown an embodimentof a processing system 300 (i.e., a computer system) for implementingthe teachings herein. In this embodiment, the processing system 300 hasone or more central processing units (processors) 301 a, 301 b, 301 c,etc. (collectively or generically referred to as processor(s) 301). Theprocessors 301, also referred to as processing circuits, are coupled viaa system bus 302 to system memory 303 and various other components. Thesystem memory 303 can include read only memory (ROM) 304 and randomaccess memory (RAM) 305. The ROM 304 is coupled to system bus 302 andmay include a basic input/output system (BIOS), which controls certainbasic functions of the processing system 300. RAM is read-write memorycoupled to system bus 302 for use by processors 301.

FIG. 3 further depicts an input/output (I/O) adapter 306 and a networkadapter 307 coupled to the system bus 302. I/O adapter 306 may be asmall computer system interface (SCSI) adapter that communicates with ahard disk 308 and/or tape storage drive 309 or any other similarcomponent. I/O adapter 306, hard disk 308, and tape storage drive 309are collectively referred to herein as mass storage 310. Software 311for execution on processing system 300 may be stored in mass storage310. The mass storage 310 is an example of a tangible storage mediumreadable by the processors 301, where the software 311 is stored asinstructions for execution by the processors 301 to perform a method,such as the process flows of FIGS. 1-2. Network adapter 307interconnects system bus 302 with an outside network 312 enablingprocessing system 300 to communicate with other such systems. A screen(e.g., a display monitor) 315 is connected to system bus 302 by displayadapter 316, which may include a graphics controller to improve theperformance of graphics intensive applications and a video controller.In one embodiment, adapters 306, 307, and 316 may be connected to one ormore I/O buses that are connected to system bus 302 via an intermediatebus bridge (not shown). Suitable I/O buses for connecting peripheraldevices such as hard disk controllers, network adapters, and graphicsadapters typically include common protocols, such as the PeripheralComponent Interconnect (PCI). Additional input/output devices are shownas connected to system bus 302 via an interface adapter 320 and thedisplay adapter 316. A keyboard 321, mouse 322, and speaker 323 can beinterconnected to system bus 302 via interface adapter 320, which mayinclude, for example, a Super I/O chip integrating multiple deviceadapters into a single integrated circuit.

Thus, as configured in FIG. 3, processing system 305 includes processingcapability in the form of processors 301, and, storage capabilityincluding system memory 303 and mass storage 310, input means such askeyboard 321 and mouse 322, and output capability including speaker 323and display 315. In one embodiment, a portion of system memory 303 andmass storage 310 collectively store an operating system, such as thez/OS or AIX operating system from IBM Corporation, to coordinate thefunctions of the various components shown in FIG. 3.

Technical effects and benefits include reducing usage of system lock byholding the system lock when a batch of elements is moved to a queuerather than holding it throughout an entire initialization and queueingprocess. Further, technical effects and benefits include improvedscalability for computer systems where a number of queue elementsincreases as the size of the system increases. Technical effects andbenefits also include a reduced path length when initializing a queuesince the service routine is called once per batch rather than once perelement. In this way, the technical effects and benefits an increasedefficiency via the batch processing since only the first and lastelements are references while the middle elements are no referenced.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present invention has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the invention. Theembodiments were chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Java, Smalltalk, C++ or the like,and conventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

1. A method for performing a batch processing, comprising: initializing,by a processor coupled to a memory, a set of elements corresponding to afirst set of resources to produce an initialized group, wherein theinitializing of the set of elements is performed without a system lock;chaining, by the processor, the initialized group to previouslyinitialized elements to produce an element batch when the previouslyinitialized elements are available, wherein the chaining of theinitialized group is performed without the system lock and wherein thepreviously initialized elements correspond to a second set of resources;setting, by the processor, the system lock on the first and second setof resources in accordance with the element batch after the initializedgroup is chained to the previously initialized elements; executing, bythe processor, a service routine to move the element batch to a queue,wherein the service routine increases an efficiency of the batchprocessing by referencing only first and last elements of the elementbatch and not middle elements of the element batch; and releasing, bythe processor, the system lock on the set of resources once the serviceroutine is complete.
 2. The method of claim 1, further comprising:receiving a request for resources, the request for resourcescorresponding to the set of elements.
 3. (canceled)
 4. The method ofclaim 1, wherein a size of the initialized element batch corresponds toan increment size of the first and second set of resources.
 5. Themethod of claim 1, further comprising: managing an indicator signifyingthat the set of elements is being initialized and is not available. 6.The method of claim 5, where the indicator is checked by a secondprocessor attempting to access the set of elements being initialized toverify that the set of elements are available for use.
 7. The method ofclaim 1, wherein the referencing of the first and last elements of theelement batch by the service routine avoids referencing middle elementsof the element batch when moving the element batch.
 8. The method ofclaim 1, further comprising: updating counts representing a number ofelements on the queue to correspond to the service routine. 9.-24(canceled)
 25. The method of claim 1, wherein each element of the set ofelements is an address pointing to a corresponding resource of the firstset of resources.
 26. The method of claim 1, wherein each element of theset of elements and the previously initialized elements are chained onthe queue via a forward and backward pointer.